import { useEffect } from 'react'
import { useState } from 'react'
import './App.css'
import GoodsInfo from './components/GoodsInfo'
import { getGoodsData,getVideoData } from './api/request'

function App() {

  const [activityKey,setActivityKey]=useState('chaodian')
  const [goodsData,setGoodsData]=useState([])
  const [videoData,setVideoData]=useState([])
  useEffect(()=>{
    (async ()=>{
      let {data}=await getGoodsData()
      let {data:videodata}=await getVideoData()

      setGoodsData([
        ...data
      ])
      // console.log(videodata);
      setVideoData([...videodata])
    })()
  },[])

  return (
    <div className="App">
      <GoodsInfo activityKey={activityKey} setActivityKey={setActivityKey} 
        goodsData={goodsData} videoData={videoData}/>
    </div>
  )
}

export default App
